home *** CD-ROM | disk | FTP | other *** search
/ FM Towns: Free Software Collection 11 / FM Towns Free Software Collection 11.iso / t_os / tool / artemis1 / src / setup.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-05-14  |  6.4 KB  |  229 lines

  1. /*
  2.     setup.c
  3.  
  4.     「各種設定」コマンド
  5.  
  6.     編集画像の大きさが(512,480)未満のときは 1倍表示不可
  7.     ★★ zoomrate の1の禁止条件のチェック!
  8. */
  9.  
  10. #define DEBUG
  11.  
  12. #include <stdio.h>
  13. #include <msdos.cf>
  14. #include <memory.h>
  15.  
  16. #include "ge.h"
  17. #include "dispman.h"
  18. #include "imageman.h"
  19.  
  20. #if 1
  21.  
  22. #define    GETITEMXY(n)    menu_getitemxy(NULL,(n),&ix,&iy,NULL,NULL)
  23. #define    GETITEMXYS(n)    menu_getbuttonxy(NULL,(n),&ix,&iy,&ixlen,&iylen)
  24.  
  25. /*--------------------------------------------------------*/
  26. /*                        内部変数                        */
  27. /*--------------------------------------------------------*/
  28.  
  29. static    int        para_lat2xlen,para_lat2ylen;
  30. static    int      _zoomY;
  31.  
  32. /*--------------------------------------------------------*/
  33. /*                「各種設定」メニューの定義                */
  34. /*--------------------------------------------------------*/
  35.  
  36. static void dspSetupMenu(),ersSetupMenu();
  37. /*
  38. enum {
  39.     selLat1Sw=0, selLat2Sw, selZoom,
  40.     selCopyop, selMatteAdj, selAreaAdj,
  41.     selSpray, selColModel, selCsrCol, selBackCol
  42. };
  43. */
  44.  
  45. #include "setup.md"
  46.  
  47. #define    IL        setupmenu.itemlist
  48.  
  49. static void dspSetupMenu()
  50. {
  51. }
  52.  
  53.  
  54. static void ersSetupMenu()
  55. {
  56. }
  57.  
  58.  
  59. /*--------------------------------------------------------*/
  60. /*                  メニューの更新用関数                  */
  61. /*--------------------------------------------------------*/
  62.  
  63.  
  64. static void drwItemCsr(int itemNum)
  65. {
  66.     int ix,iy,ixlen,iylen;
  67.     GETITEMXYS(itemNum);
  68.     grboxline(ix-2,iy-1,ixlen+4,iylen+2,DMgetmenuplt(Black),DrawNORMAL);
  69. }
  70.  
  71.  
  72. static void ersItemCsr(int itemNum)
  73. {
  74.     int ix,iy,ixlen,iylen;
  75.     GETITEMXYS(itemNum);
  76.     grboxline(ix-2,iy-1,ixlen+4,iylen+2,DMgetmenuplt(COL_menu),DrawNORMAL);
  77. }
  78.  
  79.  
  80. /*--------------------------------------------------------*/
  81. /*           設定メニューの画面モードごとの調整           */
  82. /*--------------------------------------------------------*/
  83.  
  84.  
  85. static void makeSetupMenu()
  86. {
  87.     // static ITEM items[] = {
  88.     //     { 16,180,0,0,typeSTRe,(int)"透過時の境界補正",NOFNC },    // 34
  89.     //     { 160,180,96+32,16,typeSTR,(int)"あり    なし",NOFNC }    // 35
  90.     // };
  91.     // if (mode == MODE32K)
  92.     //     memcpy(&setupmenu_items[34], &items[0], sizeof(ITEM)*2);
  93.     // else
  94.     //     memset(&setupmenu_items[34], 0, sizeof(ITEM)*2);
  95.  
  96.     menu_scrollbar_setvar(menu_scrollbar(&setupmenu,barLAT2XSIZE),para_lat2xlen);
  97.     menu_scrollbar_setvar(menu_scrollbar(&setupmenu,barLAT2YSIZE),para_lat2ylen);
  98.     menu_scrollbar_setvar(menu_scrollbar(&setupmenu,barNIZIMI),blot_depth);
  99.     menu_scrollbar_setvar(menu_scrollbar(&setupmenu,barKOSURE),goshi_para);
  100.     menu_scrollbar_setvar(menu_scrollbar(&setupmenu,barSPRAY),spray_r);
  101. }
  102.  
  103.  
  104. /*--------------------------------------------------------*/
  105. /*                   「各種設定」主処理                     */
  106. /*--------------------------------------------------------*/
  107.  
  108.  
  109. static SEL_E *selem(int s_id, int e_id)
  110. {
  111.     SEL *s = menu_selector(&setupmenu,s_id);
  112.     SEL_E *e = menu_selector_element(s,e_id);
  113.     return e;
  114. }
  115.  
  116. static int getselvar(int id)
  117. {
  118.     SEL *s = menu_selector(&setupmenu,id);
  119.     return menu_selector_getvar(s);
  120. }
  121.  
  122. static void setselvar(int id,int n)
  123. {
  124.     SEL *s = menu_selector(&setupmenu,id);
  125.     menu_selector_setvar(s,n);
  126. }
  127.  
  128.  
  129. void commandSetup()
  130. {
  131.     PRINT("commandSetup begin\n");
  132.     bool para_lat1disp,para_lat2disp;
  133.     int    para_zoomrate = DMimage_getzoomrate();
  134.     DMimage_getlatticeswitch(¶_lat1disp, ¶_lat2disp);
  135.     KNOW(menu_selector(&setupmenu, selLat1Sw) != NULL);
  136.     setselvar(selLat1Sw, para_lat1disp ? 0 : 1);
  137.     KNOW(menu_selector(&setupmenu, selLat2Sw) != NULL);
  138.     setselvar(selLat2Sw, para_lat2disp ? 0 : 1);
  139.     KNOW(selem(selZoom,seZ1) != NULL);
  140.     menu_selector_element_setavail(selem(selZoom,seZ1),minzoomrate>1?NO:YES);
  141.     setselvar(selZoom,
  142.         para_zoomrate==1 ? 0 :  para_zoomrate==2 ? 1 : 
  143.         para_zoomrate==4 ? 2 :  para_zoomrate==8 ? 3 : 4);
  144.     setselvar(selCopyop,blkop==DrawNORMAL? 0 : blkop == DrawMATTE ? 1 : 0);
  145.     setselvar(selMatteAdj, blkop_edge ? 0 : 1);
  146.     setselvar(selAreaAdj, areaadj ? 0 : 1);
  147.     setselvar(selSpray, (spray_t == 0 ? 0 : 1));
  148.     setselvar(selColModel, colmodel==MODEL_RGB ? 0 : 1);
  149.     setselvar(selCsrCol, csrcol==COL_cursorLight? 0: 1);
  150.     setselvar(selBackCol, whiteback ? 0 : 1);
  151.     setselvar(selPartSave, use_partsave ? 0 : 1);
  152.     setselvar(selLoadMove, use_loadmove ? 0 : 1);
  153.     PRINT("選択子・値設定終了\n");
  154.     DMimage_getlatticesize(¶_lat2xlen, ¶_lat2ylen);
  155.     makeSetupMenu();
  156.     menu_disp(&setupmenu);
  157.     for (;;) {
  158.         DMdispcsr(ms.x,ms.y);
  159.         for (;;) {
  160.             ms_get(&ms);
  161.             if (ms.dx!=0 || ms.dy!=0 || ms.btn1!=OFF || ms.btn2!=OFF ||
  162.              key_chk()!=0)
  163.                 break;
  164.         }
  165.         DMerasecsr();
  166.         scrollForCsr(1,1);
  167.         if (ms.btn1 == OFFON) {
  168.             int a; int ax,ay; SCROLLBAR *sbarp;
  169.             a = menu_where(ms.x,ms.y,&setupmenu, &ax,&ay,&sbarp);
  170.             switch (a)
  171.             {
  172.             case itemMoveMenu:
  173.                 menu_move();
  174.                 break;
  175.             case itemScrollBar:
  176.                 menu_touchscrollbar(sbarp, ax,ay);
  177.                 break;
  178.             case itemSelector:
  179.                 menu_touchselector(&setupmenu);
  180.                 break;
  181.             }
  182.         }
  183.         if (ms.btn2 == OFFON)
  184.             break;
  185.         if (key_read() == 27)
  186.             break;
  187.     }
  188.     menu_erase();
  189.     DMimage_setlatticeswitch(NO,NO);
  190.     int dispx,dispy;
  191.     DMimage_getdispxy(&dispx,&dispy);
  192.     int s,t;
  193.     t = getselvar(selZoom);
  194.     para_zoomrate = (t == 0 ? 1 : t == 1 ? 2 : t == 2 ? 4 : t == 3 ? 8 : 16);
  195.     DMimage_setzoomrate(para_zoomrate);
  196.     DMimage_setdispxy(dispx,dispy);
  197.     t = menu_scrollbar_getvar(menu_scrollbar(&setupmenu,barLAT2XSIZE));
  198.     s = menu_scrollbar_getvar(menu_scrollbar(&setupmenu,barLAT2YSIZE));
  199.     DMimage_setlatticesize(t,s);
  200.     blot_depth = menu_scrollbar_getvar(menu_scrollbar(&setupmenu,barNIZIMI));
  201.     goshi_para = menu_scrollbar_getvar(menu_scrollbar(&setupmenu,barKOSURE));
  202.     spray_r    = menu_scrollbar_getvar(menu_scrollbar(&setupmenu,barSPRAY));
  203.     t = getselvar(selLat1Sw);
  204.     s = getselvar(selLat2Sw);
  205.     DMimage_setlatticeswitch(t==0?YES:NO, s==0?YES:NO);
  206.     blkop = (getselvar(selCopyop)==0 ? DrawNORMAL : DrawMATTE);
  207.     blkop_edge = (getselvar(selMatteAdj)==0 ? YES : NO);
  208.     areaadj = (getselvar(selAreaAdj) == 0 ? YES : NO);
  209.     spray_t = (getselvar(selSpray) == 0 ? 0 : 1);
  210.     colmodel = (getselvar(selColModel)==0?MODEL_RGB:MODEL_HLS);
  211.     csrcol=(getselvar(selCsrCol)==0 ? COL_cursorLight:COL_cursorDark);
  212.     whiteback = (getselvar(selBackCol) == 0 ? YES : NO);
  213.     use_partsave = (getselvar(selPartSave) == 0 ? YES : NO);
  214.     use_loadmove = (getselvar(selLoadMove) == 0 ? YES : NO);
  215.     PRINT("commandSetup end\n");
  216. }
  217.  
  218. /* end of setup.c */
  219.  
  220.  
  221.  
  222. #else
  223.  
  224. void commandSetup()
  225. {
  226. }
  227.  
  228. #endif
  229.